﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Newtonsoft.Json.Linq;
using xbmc_json_async.System;
using xbmc_json_async.Utilities;

namespace xbmc_json_async.Media
{
    public class MusicVideo : xbmc_json_async.Types.Video.Details.MusicVideo
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MusicVideo"/> class.
        /// </summary>
        public MusicVideo() { }
        /// <summary>
        /// Froms the json object.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        public static MusicVideo FromJsonObject(JObject item)
        {
            var musicVideo = new MusicVideo();

            //populate
            musicVideo.album = XHelpers.Jval(item, "album");
            musicVideo.artist = XHelpers.Jval(item, "artist");
            musicVideo.director = XHelpers.Jval(item, "director");
            musicVideo.fanart = XHelpers.Jval(item, "fanart");
            musicVideo.file = XHelpers.Jval(item, "file");
            musicVideo.genre = XHelpers.Jval(item, "genre");
            musicVideo.label = XHelpers.Jval(item, "label");
            musicVideo.lastplayed = XHelpers.Jval(item, "lastplayed");
            musicVideo.musicvideoid = XHelpers.JvalInt(item, "musicvideoid");
            musicVideo.playcount = XHelpers.JvalInt(item, "playcount");
            musicVideo.plot = XHelpers.Jval(item, "plot");
            musicVideo.runtime = XHelpers.Jval(item, "runtime");
            musicVideo.studio = XHelpers.Jval(item, "studio");
            musicVideo.thumbnail = XHelpers.Jval(item, "thumbnail");
            musicVideo.title = XHelpers.Jval(item, "title");
            musicVideo.track = XHelpers.JvalInt(item, "track");
            musicVideo.year = XHelpers.JvalInt(item, "year");

            return musicVideo;

        }
    }
}
